From e9ed210b0be283676f54bcb232aebc66b9741825 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 6 Jun 2014 18:00:36 -0400 Subject: [PATCH] GtkMenu: take csd shadows into account for placement When placing menus, we don't want the shadow to influence our choice. https://bugzilla.gnome.org/show_bug.cgi?id=731187 --- gtk/gtkmenu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index fa176418bc..f1bf2436fa 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -111,6 +111,7 @@ #include "gtkintl.h" #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" +#include "gtkwindowprivate.h" #include "deprecated/gtktearoffmenuitem.h" @@ -4474,6 +4475,7 @@ gtk_menu_position (GtkMenu *menu, GdkScreen *pointer_screen; GdkRectangle monitor; GdkDevice *pointer; + GtkBorder border; widget = GTK_WIDGET (menu); @@ -4485,8 +4487,11 @@ gtk_menu_position (GtkMenu *menu, * the right place to popup the menu. */ gtk_widget_realize (priv->toplevel); - requisition.width = gtk_widget_get_allocated_width (widget); - requisition.height = gtk_widget_get_allocated_height (widget); + + _gtk_window_get_shadow_width (GTK_WINDOW (priv->toplevel), &border); + + requisition.width = gtk_widget_get_allocated_width (widget)- border.left - border.right; + requisition.height = gtk_widget_get_allocated_height (widget) - border.top - border.bottom; if (pointer_screen != screen) { @@ -4658,6 +4663,9 @@ gtk_menu_position (GtkMenu *menu, x = CLAMP (x, monitor.x, MAX (monitor.x, monitor.x + monitor.width - requisition.width)); + x -= border.left; + y -= border.top; + if (GTK_MENU_SHELL (menu)->priv->active) { priv->have_position = TRUE; -- 2.30.2